home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
comm
/
term
/
vltj5867.lha
/
VLT
/
rexx
/
MarginBell.vlt
< prev
next >
Wrap
Text File
|
1994-03-27
|
1KB
|
59 lines
/** MarginBell.vlt
*
* Example program to intercept keystrokes.
* This one implements a margin bell at 72 colums
*
**/
margincol = 72
/*
* Add libraries if necessary
*/
if show("l", "rexxarplib.library") = 0 then do
check = addlib('rexxsupport.library', 0, -30, 0)
check = addlib('rexxarplib.library', 0, -30, 0)
end
/*
* Open a port
*/
mp = openport(MARGIN_BELL)
/*
* Tell VLT to send us stuff
*/
"wedge keystrokes MARGIN_BELL"
/*
* Loop until quitflag is 1, waiting for packets
*/
do forever
if quitflag = 1 then leave
t = waitpkt(MARGIN_BELL)
/*
* We got a number of packets. Loop over all of them.
*/
do ff = 1
p = getpkt(MARGIN_BELL)
if c2d(p) = 0 then leave ff
line = getarg(p)
t = reply(p, 1)
/*
* Got something. Find out what...
*/
parse var line command code qual iaddr char .
/*
* If we got an "esc", quit.
*/
if char = '1B'x then do
quitflag = 1
"$1: BEEP; delay .7; BEEP; delay .7; BEEP"
end
/*
* Else check the current cursor x position. Send VLT a BEEP command if it
* is at the margin column.
*/
else do
"extract x"
if VLT.x > margincol then "BEEP"
end
end
end